import request from '@/utils/request'

// 发送文章评论
export function sendComment(
  type: string,
  articleId: number,
  rootId: number,
  toCommentId: number,
  toCommentUserId: number,
  content: string
) {
  return request({
    url: '/comment',
    method: 'post',
    data: {
      articleId: articleId,
      type: type,
      rootId: rootId,
      toCommentId: toCommentId,
      toCommentUserId: toCommentUserId,
      content: content
    }
  })
}

//获取文章评论
export function getArticleComment(articleId: number, pageNum: number, pageSize: number) {
  return request({
    url: '/comment/commentList',
    method: 'get',
    headers: {
      isToken: false
    },
    params: {
      articleId,
      pageNum,
      pageSize
    }
  })
}

//友链评论列表
export function getLinkComment(pageNum: number, pageSize: number) {
  return request({
    url: '/comment/linkCommentList',
    method: 'get',
    params: {
      pageNum,
      pageSize
    }
  })
}
